package com.service.imple.admin;

import com.dao.RechargeLogMapper;
import com.entity.RechargeLog;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.service.admin.RechargeLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class RechargeLogServiceImple implements RechargeLogService {

    @Autowired
    private RechargeLogMapper rechargeLogMapper;

    @Override
    public PageInfo<RechargeLog> selectByPage(Map<String, Object> param) {
        int pageNum=Integer.parseInt(param.get("pageNum").toString());
        PageHelper.startPage(pageNum,6);
        List<RechargeLog> list = rechargeLogMapper.SelectPage(param);
        PageInfo<RechargeLog> info =new PageInfo<>(list);
        return info;
    }

    @Override
    public List<RechargeLog> select(Map map) {
        return rechargeLogMapper.SelectPage(map);
    }

    @Override
    public int insert(RechargeLog rechargeLog) {
        return rechargeLogMapper.insert(rechargeLog);
    }

    @Override
    public int update(RechargeLog rechargeLog) {
        return rechargeLogMapper.updateByPrimaryKey(rechargeLog);
    }

    @Override
    public int delete(int id) {
        return rechargeLogMapper.deleteByPrimaryKey(id);
    }
}
